import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:ost_flutter_module/common/adapt.dart';
import 'package:ost_flutter_module/common/color.dart';
import 'package:ost_flutter_module/common/styles.dart';
import 'package:ost_flutter_module/common/utils.dart';
import 'package:ost_flutter_module/help/ost_route.dart';
import 'package:ost_flutter_module/widget/custom_widget/image_text_button.dart';
import 'package:ost_flutter_module/widget/custom_widget/rounded_button.dart';

import 'bloc/shop_cart_bloc.dart';

class StoreShopCartBottomNavigationBar extends StatelessWidget {
  final bool check;
  final VoidCallback onTap;

  const StoreShopCartBottomNavigationBar(
      {Key key, this.check = false, this.onTap})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return BlocBuilder<ShopCartBloc, ShopCartState>(builder: (context, state) {
      return BottomAppBar(
        color: Colors.white,
        child: Padding(
          padding: EdgeInsets.only(
              top: Adapt.px(10), left: Adapt.px(10), right: Adapt.px(10)),
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              GImageTextButton(
                '全选',
                svg: Utils.svgAssets('icon_unselected'),
                textStyle: TextStyles.titleStyle,
                textLeadingPadding: 10,
              ),
              Expanded(
                child: RichText(
                  textAlign: TextAlign.end,
                  text: TextSpan(
                    text: '合计：',
                    style: TextStyles.titleStyle,
                    children: [
                      TextSpan(text: '￥1800', style: TextStyles.priceTitleStyle)
                    ],
                  ),
                ),
              ),
              SizedBox(width: Adapt.px(10)),
              RoundedButton(
                  enableColor: colorFACD33,
                  buttonWidth: Adapt.px(120),
                  text: '提交订单',
                  textColor: color42270C,
                  textSize: 16,
                  onTap: () {
                    Navigator.pushNamed(context, GRouter.order_page);
                    onTap();
                  }),
            ],
          ),
        ),
      );
    });
  }
}
